<template>
  <div id="app">
    <router-view/>
  </div>
</template>

<script>
import * as API from "./http/api.js";
export default {
  name: "App",
  data() {
    return {
      userInfo:null
    };
  },
  created() {
    this.getuserInfo();
  },
  methods: {
    getuserInfo() {
       this.$http({
        method: "get",
        url: API.userInfo,
        params: {},
        customErr: true
      }).then(res=>{
        console.log(`用户信息`,res)
        this.userInfo=res
        if(this.userInfo.expertId===null&&this.userInfo.isManager===false){
          // this.userInfo.navList=this.$store.state.childRouter.manager
          this.userInfo.iswho='zg'
          this.userInfo.option=[{lable:'管理员',value:'管理员'},{lable:'专家',value:'专家'}]
          this.userInfo.navList=this.$store.state.childRouter.manager
          console.log(`触发vux getinfo>>>>>>>>>>>>>>>>>>>>>>>`)
          // this.$emit('getInfoData',this.userInfo)
          this.$store.commit(`getInfoData`,this.userInfo)
          console.log(`userInfo`,this.userInfo)
        }

      })
      // let iswho = "g";
      // if (iswho === `g`) {
      //   this.navtive = this.$store.state.childRouter.A[0].children;
      //   console.log(this.navtive)
      //   this.$store.commit('native/getNavList',this.navtive)
      //   let router =this.$store.state.childRouter.A
      //   this.$router.addRoutes(router)
      //   this.$router.options=router
      //   console.log(this.$router.options);
      // }
    }
  }
};
</script>

<style>
</style>
